home *** CD-ROM | disk | FTP | other *** search
- Path: library.erc.clarkson.edu!koglerje
- From: koglerje@craft.camp.clarkson.edu (Mountain (jimbo) )
- Newsgroups: comp.lang.c
- Subject: Re: ?? How to dump text files to screen ??
- Date: 12 Mar 1996 03:10:25 GMT
- Organization: Clarkson University
- Message-ID: <4i2pv1$it4@library.erc.clarkson.edu>
- References: <31430CE8.469E@aol2.com>
- NNTP-Posting-Host: fire.camp.clarkson.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Neil (neil@aol2.com) wrote:
- : I need help -- how can I open up a text file and just dump it
- : all out (in plain text) to the screen?
-
- : Please post solution or mailto:neil@aol2.com
-
- : Thanks!
- : Neil Mansilla
-
- Open a the file, then read in charters until the end, echo the charaters
- to the screen. done like so:
- ----
- include <stdio.h>
- main()
- {
- FILE *fptr;
- char ch;
-
- fptr = fopen("YOUR FILE NAME AND PATH","+r");
- if (fptr == NULL)
- {printf("\nERROR, NO FILE FOUND\n");
- return(-1);
- }
- while (ch != EOF)
- { ch=fgetch(fptr);
- fputch(stderr,ch);
- }
- }
- ----
- Ok, if i didn't make stupid mistakes then thats it, check and see if its putch
- or puts that you want to use.
-
- good luck
- jimbo
-
-
- _________________________________________________________________
- Jim Kogler | To Error is Human,
- mountain@wckn.dorm.clarkson.edu | To Debug, Devine.
- koglerje@wckn.dorm.clarkson.edu |
- http://fire.clarkson.edu/~koglerje/ |
-
-